<?php
declare(strict_types=1);
namespace cms\exam\api_controller;

use cms\exam\service\AppService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Psr\Http\Message\ResponseInterface;

/**
 * Class AppController
 * @package cms\exam\api_controller
 * @Controller(prefix="api/exam/app")
 */
class AppController extends CommonController
{
    /**
     * @Inject()
     * @var AppService
     */
    protected AppService $appService;

    /**
     * @return ResponseInterface
     * @RequestMapping(path="detail")
     */
    public function detail(): ResponseInterface
    {
        // 站点ID
        $id = (int) $this->request->input('id', 0);
        $data = $this->appService->getDataById($id, true);
        return $this->success('请求成功', $data);
    }
}